<div class="blockcms" >

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script src="<?php  echo JS_PATH?>/jquery/ui/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>

    <script  src="<?php  echo JS_PATH.'/jquery/validate/jquery.validate2.js';?>"></script>
    
    <!--script src="<?php  echo JS_PATH?>/jquery/ValidationEngine/js/jquery.validationEngine-vi.js" type="text/javascript" charset="utf-8"></script>
    <script src="<?php  echo JS_PATH?>/jquery/ValidationEngine/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
        <link rel="stylesheet" href="<?php  echo JS_PATH?>/jquery/ValidationEngine/css/validationEngine.jquery.css" type="text/css"/>
        <script>
            $(document).ready(function(){
                // binds form submission and fields to the validation engine
                $("#commentForm").validationEngine('attach');
            });
        </script-->
<style type="text/css" >
    .tdleft{
        width: 110px;
    }
    .title{
        color: #E33588;
        font-size: 13pt;
    }
    .clickhere
    {
         color: #E33588;
    }
</style>
<script>//validate combobox
     /*jQuery.validator.addMethod(
	  "combobox",
	  function(value, element) {
	    if (element.value == "")
	    {
	      return false;
	    }
	    else return true;
	  },
	  "Bạn chưa chọn giá trị"
	);
   
    jQuery.validator.addMethod(//validate textbox
	  "form",
	  function(value, element) {
	    if (element.value == ""
                )
	    {
	      return false;
	    }
	    else return true;
	  },
	  "Moi ban chon"
	);
*/    
  $(function() {
		$( "#datepicker" ).datepicker({ 
            changeYear: true,changeMonth: true ,
            showOn: 'button',
            buttonImage: '<?=IMAGE_PATH?>/icon_calendar.jpg', 
            buttonImageOnly: true, onSelect: function () { }, 
            onClose: function () { $(this).focus(); },
            dateFormat: 'd/mm/yy'
            //,yearRange: '<?=date('Y', time()) - 90?>:<?=date('Y', time()) - 20?>'
        });
	});
  $(document).ready(function(){
  
        $.validator.addMethod('isDate', function(value, element)
        {
            var isDate = false;
            try
            {
                $.datepicker.parseDate('dd/mm/yy', value);
                isDate = true;
            }
            catch (e)
            {
                
            }
            alert(isDate);
            return isDate;
        });



    $("#commentForm").validate({
		rules: {
			
            datepicker: {
                required: true,
                isDate: true
            },
			username: {
				required: true,
				minlength: 3
			},
			password: {
				required: true,
				minlength: 5
			},
			confirm_password: {
				required: true,
				minlength: 5,
				equalTo: "#password"
			},
			email: {
				required: true,
				email: true
			},
			
			agree: "required",
			captcha: "required",
            aboutus: "required",
            country: "required",
            address: "required",
            aboutus: "required",
            address: "required",
            city: "required",
            state: "required",
            zipcode: "required",
            mobilfone: "required",
            firstname: "required",
            lastname: "required"
		}
        
	});

  });
  </script>

    <?php
        $email=$this->email;
        $username=$this->username ."";
        $firstname = $this->firstname;
        $lastname = $this->lastname;
        $address = $this->address ;
        $address2 = $this->address2;
        $zipcode = $this->zipcode ;
        
        $date = $this->birtday ;
        if ($date == '') {
            $date = "01/01/" . (date('Y') - 18);
        }
        $smoking = $this->smoking ;
        $aboutme = $this->aboutme ;
        $looking = $this->looking ;
        $error = $this->error;
        $weight = $this->weight;
        $height = $this->height;
        
        $country = $this->country;
        $company = $this->company;
        $city = $this->city;
        $state = $this->state;
        $mobilfone = $this->mobilfone;
        $numberfone = $this->numberfone;
        $fax = $this->fax;
        $aboutus = $this->about_us;
       
    ?>
  <!-- Your content goes here -->
    <a class="clickhere" href="<?=BASE_URL?>/index/index/preparelogin"><img src="<?php echo JS_PATH?>/skincarebyalana/images/Support-icon-customer-login.jpg" /></a><br />
    <div style="padding:5px;border:1px solid gray;">
        <h3 class="title">
            Customer Registration
        </h3>
    </div>
    <br />

            <?php
                if($error) {
            ?>
                <div style="color: red; font-size: 15px; " class="errormessage"><?=$error?></div><br />
            <?php
                }
            ?>
                <form action="<?=BASE_URL?>/user/register" method="post" name="commentForm" id="commentForm" class="formular">
                <table  border="0" cellpadding="0" cellspacing="0" style="width:95%;margin:0 auto;">
                    <tbody>
                    <tr>
                        <td colspan="2">
                            <?php echo $this->message;?>
                        </td>
                    </tr>
                        <tr>
                            <td class="tdleft">First Name:</td>
                            <td><input class="uniform validate[required]  text-input input" type="text" id="firstname" name="firstname" value="<?=$firstname?>" /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Last Name:</td>
                            <td><input class="uniform validate[required]  text-input input" type="text" id="lastname" name="lastname" value="<?=$lastname?>" /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Password:</td>
                            <td><input class="uniform validate[required] text-input input" type="password" name="password" id="password"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Confirm Password:</td>
                            <td><input class="uniform validate[required,equals[password]] text-input input" type="password" name="confirm_password" id="confirm_password" /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Email:</td>
                            <td><input class="uniform validate[required,custom[email]] input" type="text" name="email" id="email" value="<?php echo $email?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Company:</td>
                            <td><input class="uniform input" type="text" name="company" id="company" value="<?php echo $company?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Street:</td>
                            <td><input class="uniform validate[required] input" type="text" name="address" id="address" value="<?php echo $address?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Street 2:</td>
                            <td><input class="input uniform" type="text" name="address2" id="address2" value="<?php echo $address2?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">City:</td>
                            <td><input class="uniform validate[required] input" type="text" name="city" id="city" value="<?php echo $city?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">State:</td>
                            <td><input class="uniform validate[required] input" type="text" name="state" id="state" value="<?php echo $state?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Postal Code:</td>
                            <td><input class="uniform validate[required] input" type="text" name="zipcode" id="zipcode" value="<?php echo $zipcode?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Country:</td>
                            <td>
                                <select name="country" class="uniform validate[required] input" class="combobox">
                                    <option value="">Country</option>
                                    <?php
                                        $rowcountry = $this->rowcountry;
                                        foreach ($rowcountry as $value) {
                                            ?>
                                                <option value="<?=$value['country_code']?>" <?php if($value['country_code'] == $country) {echo " selected";}?>><?=$value['country_name']?></option>
                                            <?php
                                        }
                                    ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdleft">Phone:</td>
                            <td><input class="uniform validate[required,custom[number]] input" type="text" name="numberfone" id="numberfone" value="<?php echo $numberfone?>"  /></td>
                        </tr>
                        <!--<tr>
                            <td class="tdleft">Evening Phone:</td>
                            <td><input class="uniform" type="text" name="numberfone" id="numberfone" value="<?php //echo $numberfone?>"  /></td>
                        </tr>
                        <tr>
                            <td class="tdleft">Fax</td>
                            <td><input class="uniform" type="text" name="fax" id="fax" value="<?php //echo $fax?>"  /></td>
                        </tr>-->
                        <tr>
                            <td class="tdleft">Captcha image</td>
                            <td>
                                <img class="uniform input" src="<?php echo BASE_URL?>/user/captcha">
                            </td>
                        </tr>
                        <tr>
                            <td class="tdleft">Fill the text in captcha image
                            </td>
                            <td >
                                <input type="text" id="captcha" name="captcha" class="uniform validate[required]"/>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdleft">How did your heard about us?
                            </td>
                            <td>
                                <!--<input type="text" id="aboutus" name="aboutus" value="<?php //echo $aboutus?>"  class="uniform"/>-->
                                <select name="aboutus" class="uniform validate[required] input" class="combobox">
                                    <option value="Friend">Friend</option>
                                    <option value="Blog">Blog</option>
                                    <option value="Google">Google</option>
                                    <option value="Bing">Bing</option>
                                    <option value="Yahoo">Yahoo</option>
                                    <option value="Postcard">Postcard</option>
                                    <option value="Advertisement">Advertisement</option>
                                    <option value="Other">Other</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td>
                                <input type="submit" name="submit" id="submit" value="Submit" class="uniform "/>
                                <input type="reset" value="Reset" class="uniform "/>
                            </td>
                            
                        </tr>
                    </tbody>
                </table>
            </form>
            <style>
                #commentForm input{width:200px}
            </style>
</div>

